package controllers

import (
	"time"

	"github.com/astaxie/beego"
	"github.com/astaxie/beego/cache"
	_ "github.com/astaxie/beego/cache/redis"
	"github.com/gomodule/redigo/redis"
)

/**
CacheController
*/
type CacheController struct {
	beego.Controller
}

//登录页面
func (c *CacheController) Get() {
	//cacheObject, _ := cache.NewCache("file", `{"CachePath":"./cache","FileSuffix":".cache","DirectoryLevel":"2","EmbedExpiry":"120"}`)
	cacheObject, _ := cache.NewCache("redis", `{"key":"beecache","conn":"127.0.0.1:6379","dbNum":"5","password":""}`)
	cacheObject.Put("astaxie_key", string("value"), 10*time.Second)
	value, _ := redis.String(cacheObject.Get("astaxie_key"), nil)
	c.Data["data"] = value
	c.TplName = "cache.html"
}
